home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_08_05
/
8n05100a
< prev
next >
Wrap
Text File
|
1990-04-17
|
815b
|
43 lines
*****Listing 2*****
/* test driver for iqsort */
/* do not use -O2 or higher with Sun C */
#include <stdio.h>
#define NSIZE 1000
#define IA 171
#define IC 11213
void iqsort();
main()
{
#ifndef __STDC__
unsigned int fx;
#else
unsigned short fx;
#endif
unsigned int a[NSIZE], *indx[NSIZE+1];
unsigned int i, j;
for( i = 0; i < NSIZE; ++i) /* not a serious random number generator */
a[i] = (fx = fx * IA + IC);
for( i=1; i <= NSIZE / 12; ++i)
{
printf("\n");
for(j = 1; j <= 12; ++j)
printf("%6u", a[12 * (i - 1) + j - 1]);
}
iqsort(NSIZE, &a[-1], &indx[-1]); /* expects 1 based arrays */
printf("\nSorted array:\n");
for( i=1; i <= NSIZE / 12; ++i)
{
printf("\n");
for(j = 1; j <= 12; ++j)
printf("%6u", *indx[12 * (i-1) + j - 1]);
}
}